def method(value):
#divmod()是内置函数，返回整商和余数组成的元组
result = []
while value:
    value, r = divmod(value, 10)
    result.append(r)
    result.reverse()
    return result
code = method(int(input('type the 12-digit bar code'))) 
s=0
t=0
i=0
while i<=5:
    s=s+code[2*i+1]
    t=t+code[2*i]
    i=i+1
m=3*s+t
n=m-int(m/10)*10
print('the check code is',10-n) 